package com.hr.reactive.mono.s02;

import com.hr.reactive.mono.s01.sub.SubscriberImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import reactor.core.publisher.Mono;

public class LazyStream01 {
    private static final Logger log = LoggerFactory.getLogger(LazyStream01.class);

    public static void main(String[] args) {

//        //流默认是懒加载
//        Stream.of(1).peek(l -> log.info("received:{}", l))
//                .toList();
        var mono = Mono.just("test");
        var sub = new SubscriberImpl();
        mono.subscribe(sub);
        sub.getSubscription().request(90);
        sub.getSubscription().request(90);
        sub.getSubscription().cancel();
        sub.getSubscription().request(90);
    }


}
